package dynamicPrograming.钢条切割;

public class digui {

    public static int cut(int[] p , int n ){

        if(n==0){
            return 0;
        }

        int q = Integer.MIN_VALUE ;
        for(int i = 1 ; i <= n ; i++){
            q = Math.max(q , p[i] + cut(p,n-i));
        }
        return q;
    }

    public static void main(String[] args) {
        int[] p = new int[]{0,1,5,8,9,10,17,17,20,24,30};
        System.out.println(cut(p,10));
    }

}
